package com.example.provider;

import com.example.provider.server.RpcServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * 创建三个线程
 *
 * @author kangshuai
 */
@SpringBootApplication
public class RpcProviderApplication implements CommandLineRunner {


    @Autowired
    RpcServer rpcServer;

    public static void main(String[] args) {
        SpringApplication.run(RpcProviderApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        new Thread(new Runnable() {
            @Override
            public void run() {
                rpcServer.startServer("127.0.01", 9001);
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                rpcServer.startServer("127.0.01", 9002);
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                rpcServer.startServer("127.0.01", 9003);
            }
        }).start();

    }
}
